<template>
  <div class="execution">
    <basic-container>
      <avue-crud
        v-model="form"
        v-bind="bindVal"
        v-on="onEvent"
        :page.sync="page"
        :permission="permissionList">
        <template slot="menuLeft">
          <el-button type="primary" size="small" @click="archive">归档</el-button>
        </template>
      </avue-crud>
    </basic-container>
  </div>
</template>

<script>
import baseCrud from '@/mixins/base-crud'
import {archive} from '@/api/support/swpmtvmaccountlog'

export default {
  name: 'swpmtvmaccountlog',
  mixins: [baseCrud('support/swpmtvmaccountlog')],
  data() {
    return {
      selectedRows: []
    }
  },
  computed: {
    permissionList() {
      return {
        addBtn: this.vaildData(this.permissions.support_sw_pm_tvm_account_log_add, false),
        delBtn: this.vaildData(this.permissions.support_sw_pm_tvm_account_log_del, false),
        editBtn: this.vaildData(this.permissions.support_sw_pm_tvm_account_log_edit, false)
      }
    }
  },
  methods: {
    archive() {
      var tableSelect = this.$refs.crud.tableSelect
      if (tableSelect.length == 0) {
        this.$message.info('请选择要归档的数据')
      } else {
        let idList = tableSelect.map(r => r.id)
        archive(idList).then(res => {
          this.$message.success('归档成功');
          this.getList(this.page)
        })
      }
    }
  }
}
</script>
